package cn.com.aiouyi.entity;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.com.aiouyi.entity.Navigation.LinkConverter;
import cn.com.aiouyi.vo.Link;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "t_photo")
public class Photo extends SeqEntity<Long>{
	
	private static final long serialVersionUID = 1L;

	/** 图片名称*/
	private String name;
	
	/** 图片相关的文字(以便展示时需要显示文字)*/
	private String text;
	
	/** 图片*/
	@ManyToOne(cascade={javax.persistence.CascadeType.REMOVE}, fetch=FetchType.LAZY)
	private Accessory accessory;
	
	/** 对应的图片位*/
	@ManyToOne(fetch=FetchType.LAZY)
    private PhotoPosition photoPosition;
	
	/** 是否显示*/
	@Column(columnDefinition="bit default true")
	private Boolean isDisplay = true;
	
	/** 是否新窗口打开，默认true  */
	@Column(columnDefinition="bit default true")
	private Boolean isOpenNew = true;
	
	/** 链接对象 */
	@Column(length = 4000)
	@Convert(converter = LinkConverter.class)
	private Link link;
}
